<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 组合 => 构造继承+原型继承 */
        function Animal(name,age,gender){
            this.name = name;
            this.age = age;
            this.gender = gender;
        }
        Animal.prototype.eat = function(){
            console.log("吃");
        }


        function Son(name,age,gender){
            //构造继承
            Animal.call(this,name,age,gender)
        }
        /* 构造继承 */
        Son.prototype = new Animal();

        let s = new Son("文渊",18,"男")
        s.eat();
        console.log(s);

    </script>
</body>
</html>